package com.bao.test.test01;

import java.io.Serializable;

/**
 * @author baoye
 * @date 2024-08-09/19:47
 */
public class Student implements Comparable<Student>{
    private Integer sid;
    private String name;
    private Integer age;

    public Student() {
    }

    public Student(Integer sid, String name, Integer age) {
        this.sid = sid;
        this.name = name;
        this.age = age;
    }

    public Integer getSid() {
        return sid;
    }

    public void setSid(Integer sid) {
        this.sid = sid;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Student student = (Student) o;

        return sid != null ? sid.equals(student.sid) : student.sid == null;
    }

    @Override
    public int hashCode() {
        return sid != null ? sid.hashCode() : 0;
    }

    @Override
    public String toString() {
        return "学号"+sid+"\t姓名:"+name+"\t年龄"+age;
    }

    @Override
    public int compareTo(Student o) {
        return o.age.compareTo(this.age);
    }
}
